package Pi;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class CubicConvergence {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int numSteps = 3;
		
		BigDecimal a = new BigDecimal("1");
		System.out.println(a);
		//a = a.divide(new BigDecimal("3"));
		//System.out.println(a);
		a = a.divide(new BigDecimal("3"), RoundingMode.HALF_EVEN);
		System.out.println(a);
		
		double s = (Math.sqrt(3)-1)/2;
		double r;
		
		int i = 0;
		for (i=0; i<numSteps; i++)
		{
			r = 3/(1+2*Math.pow((1-Math.pow(s, 3)),1/3));
			s = (r-1)/2;
			//a = Math.pow(r, 2)*a - Math.pow(3, i)*(Math.pow(r, 2)-1);
		}
		
		//a = 1/a;
		//System.out.println(a);
	}
}
